<?php
namespace tool;
use app\model\UserToken;
use support\think\Cache;
use think\facade\Db;
/**
 *
 */
class User
{
    //查找所有文件夹内文件
    public static function findMe($id=0){
        $user='';
        if($id){
            $user=\app\model\User::where('id',$id)->field('id,phone,name')->find();
        }elseif($token=request()->post('token')){
            $user=\app\model\UserModel::where('token',$token)->field('id,phone,name')->find();
        }
        if(!$user){
            $user=['id'=>0,'phone'=>'','name'=>''];
        }
        return $user;
    }
    public static function findMeRedis(){
        $user=User::findMe();
        $str='user:chooseRole:'.$user['id'];
        $user=Cache::store('redis')->handler()->get($str);
        return $user;
    }
    public static function findManage(){
        $arr=[];
        return $arr;
    }







}